/*
 * std_data.c
 *
 *  Created on: Mar 23, 2017
 *      Author: jzj
 */
#include "sec_common.h"
#include "stdlib.h"
#include "std_data.h"

void STD_SM1(void)
{
	struct std_data *sm1 = &std_sm1;
	u8 key[] = {
		/* KEY 1 for ecb */
		0xAF,0x86,0x18,0x23,0x8C,0x94,0xA1,0x19,0xAE,0x6D,0xE9,0x22,0xDB,0xB9,0x35,0x4D,
		/* KEY 2 for ecb */
		0x9F,0xCE,0xB8,0x96,0x34,0x5C,0xE3,0x7C,0x3F,0xFE,0x54,0xEA,0xD1,0x15,0x28,0xED,
		/* KEY 3 for cbc */
		0xE3,0x83,0x0F,0x2F,0xF5,0x87,0x7D,0xAD,0x19,0x41,0x75,0x7B,0x17,0xB5,0xE3,0x92,
		/* KEY 4 for cbc */
		0xB5,0x1D,0x7D,0x21,0x15,0xE7,0x0F,0x8B,0x6E,0x93,0x91,0x98,0xEB,0x6F,0xDE,0x4B};

	memcpy_c(sm1->key,key,64);

	u8 iv[] = {
		/* IV 1 for key 3 */
		0x38,0x32,0xF2,0x7E,0x0A,0x14,0x51,0xAF,0x4B,0x97,0x47,0xA0,0x17,0x7C,0xDF,0xC2,
		/* IV 2 for key 4 */
		0x60,0x91,0x8F,0xB0,0x20,0x16,0x31,0x23,0xBB,0x44,0x35,0xB5,0xA6,0xB2,0xE6,0x97};

	memcpy_c(sm1->iv,iv,32);

	u8 data[] = {
		/* DATA 1 for ecb */
		0xF7,0xAF,0x83,0xD4,0x98,0x7A,0x94,0x83,0x98,0xEE,0x24,0x8A,0xD8,0xB7,0x09,0x95,
		/* DATA 2 for ecb */
		0xC2,0xB7,0x71,0xDA,0x0F,0x6B,0x20,0xBE,0x95,0x31,0x48,0xB5,0xE6,0x01,0xF7,0x31,
		/* DATA 3 for cbc */
		0x63,0x36,0x3D,0x95,0xAC,0x94,0x46,0x28,0x29,0x2D,0xB1,0x2F,0x6B,0x39,0x37,0x5C,
		0x66,0x17,0x94,0x6A,0xFC,0xC2,0x73,0x14,0xE5,0xA9,0x4B,0x59,0xA1,0x98,0xCC,0x33,
		/* DATA 4 for cbc */
		0x29,0xBE,0x3B,0xDF,0xE2,0x16,0xA8,0xA2,0x52,0x4F,0xE9,0x38,0x31,0xE6,0xC2,0xD2,
		0x8F,0x39,0x8A,0x77,0xE5,0x3C,0x00,0xCF,0xA1,0x4D,0xD9,0xBE,0x2C,0xCE,0x61,0xCB};

	memcpy_c(sm1->data,data,96);

	u8 stddata[] = {
		/* STD OUT 1 for ecb */
		0x01,0xA6,0x85,0xCE,0xF4,0x72,0x21,0xD0,0x99,0x5F,0x8B,0xED,0xC9,0x58,0x78,0xDB,
		/* STD OUT 2 for ecb */
		0xC9,0x69,0x55,0xA6,0xB9,0x38,0xDC,0xFD,0xCD,0x57,0xF6,0x19,0xB2,0x48,0xAA,0xE3,
		/* STD OUT 3 for cbc */
		0xC6,0x2A,0xC6,0xF7,0x8E,0xEF,0xFE,0x46,0x71,0x20,0x06,0x5B,0x84,0x36,0xB7,0xDF,
		0xA8,0x63,0xAB,0x9F,0x73,0xC0,0x4B,0xBE,0x9D,0xAE,0x78,0xE5,0x92,0x09,0x71,0x01,
		/* STD OUT 4 for cbc */
		0x37,0xB1,0xB1,0x27,0x34,0xBA,0x1A,0xEF,0x45,0x20,0x94,0x96,0xED,0x75,0x58,0x43,
		0x8A,0xB5,0x2C,0x5C,0x1D,0x0B,0x53,0x22,0x02,0xD8,0x0B,0xAE,0x11,0xE9,0x22,0x52};

	memcpy_c(sm1->stdout,stddata,96);
}

void STD_SM6(void)
{
	struct std_data *sm6 = &std_sm6;
	u8 key[] = {
		/* KEY 1 for ecb */
		0x40,0xbb,0x12,0xdd,0x6a,0x82,0x73,0x86,0x7f,0x35,0x29,0xd3,0x54,0xb4,0xa0,0x26};
	memcpy_c(sm6->key,key,16);

	u8 data[] = {
		/* DATA 1 for ecb */
		0xff,0xee,0xdd,0xcc,0xbb,0xaa,0x99,0x88,0x77,0x66,0x55,0x44,0x33,0x22,0x11,0x00};
	memcpy_c(sm6->data,data,16);

	u8 stddata[] = {
		/* STD OUT 1 for ecb */
		0xed,0xd5,0x18,0x48,0xb6,0xde,0x03,0xfd,0x3f,0xf3,0x0d,0xfe,0xcc,0x8d,0xb8,0x1b};
	memcpy_c(sm6->stdout,stddata,16);
}

void STD_SMS4(void)
{
	struct std_data *sm4 = &std_sm4;
	u8 key[] = {
		/* KEY 1 for ecb */
		0x77,0x7f,0x23,0xc6,0xfe,0x7b,0x48,0x73,0xdd,0x59,0x5c,0xff,0xf6,0x5f,0x58,0xec,
		/* KEY 2 for ecb */
		0x77,0x7f,0x23,0xc6,0xfe,0x7b,0x48,0x73,0xdd,0x59,0x5c,0xff,0xf6,0x5f,0x58,0xec,
		/* KEY 3 for cbc */
		0x77,0x7f,0x23,0xc6,0xfe,0x7b,0x48,0x73,0xdd,0x59,0x5c,0xff,0xf6,0x5f,0x58,0xec,
		/* KEY 4 for cbc */
		0x77,0x7f,0x23,0xc6,0xfe,0x7b,0x48,0x73,0xdd,0x59,0x5c,0xff,0xf6,0x5f,0x58,0xec};
	memcpy_c(sm4->key,key,64);

	u8 iv[] = {
		/* IV 1 for key 3 */
		0x77,0x7f,0x23,0xc6,0xfe,0x7b,0x48,0x73,0xdd,0x59,0x5c,0xff,0xf6,0x5f,0x58,0xec,
		/* IV 2 for key 4 */
		0xd5,0x35,0x56,0x7a,0x44,0x33,0x2e,0xa7,0x59,0x97,0xc5,0x84,0x32,0xed,0x22,0x5c};
	memcpy_c(sm4->iv,iv,32);

	u8 data[] = {
		/* DATA 1 for ecb */
		0x5f,0xe9,0x7c,0xcd,0x58,0xfe,0xd7,0xab,0x41,0xf7,0x1e,0xfb,0xfd,0xe7,0xe1,0x46,
		/* DATA 2 for ecb */
		0x5b,0xfc,0x62,0xc2,0x4d,0xf5,0x27,0xf8,0x3f,0x1f,0xe9,0xe8,0xef,0xef,0x43,0x8d,
		/* DATA 3 for cbc */
		0x5f,0xe9,0x7c,0xcd,0x58,0xfe,0xd7,0xab,0x41,0xf7,0x1e,0xfb,0xfd,0xe7,0xe1,0x46,
		0x5b,0xfc,0x62,0xc2,0x4d,0xf5,0x27,0xf8,0x3f,0x1f,0xe9,0xe8,0xef,0xef,0x43,0x8d,
		/* DATA 4 for cbc */
		0x3f,0x76,0x25,0x5a,0xfd,0xef,0x72,0x63,0xdb,0xff,0xd7,0x9f,0xef,0xe9,0x07,0x9a,
		0xff,0xe6,0x5d,0x32,0x53,0x1f,0xd7,0xb7,0xfe,0xb3,0xe4,0x58,0x72,0xbb,0xd9,0x5a};

	memcpy_c(sm4->data,data,96);


	u8 stddata[] = {
		/* STD OUT 1 for ecb */
		0x56,0xda,0x23,0xe2,0x5f,0xa7,0xcd,0x82,0x5d,0x51,0xc2,0x20,0xf5,0x98,0x09,0x0b,
		/* STD OUT 2 for ecb */
		0xc6,0x0d,0xfa,0x4e,0x6e,0x77,0x3c,0xc1,0x2b,0x2a,0x1c,0xd7,0xf2,0xd6,0x59,0x78,
		/* STD OUT 3 for cbc */
		0xdc,0x8e,0xf8,0x0e,0x1d,0x03,0xaf,0x92,0x8d,0x72,0x58,0x8e,0x99,0x1e,0xe3,0xfa,
		0xd5,0x35,0x56,0x7a,0x44,0x33,0x2e,0xa7,0x59,0x97,0xc5,0x84,0x32,0xed,0x22,0x5c,
		/* STD OUT 4 for cbc */
		0xf2,0x02,0xf0,0x0a,0x4a,0xa9,0xc6,0x08,0x80,0x53,0xe1,0xdf,0x42,0x44,0x9b,0xf9,
		0x44,0x91,0x55,0x31,0x68,0x0e,0x2a,0xf4,0x4c,0x66,0x02,0x33,0x9f,0x2a,0xe4,0x52};
	memcpy_c(sm4->stdout,stddata,96);
}

void STD_SSF33(void)
{
	struct std_data *ssf33 = &std_ssf33;
	u8 key[] = {
		/* KEY 1 for ecb */
		0x67,0xbe,0x03,0x7c,0x41,0x96,0x6d,0xdb,0x8c,0x36,0x27,0x48,0x5a,0x05,0x93,0xa5,
		/* KEY 2 for ecb */
		0xef,0x41,0xce,0xc7,0xda,0x77,0x22,0xb3,0xd7,0xa8,0x46,0xdd,0xcd,0x40,0xe5,0x17,
		/* KEY 3 for cbc */
		0xE3,0x83,0x0F,0x2F,0xF5,0x87,0x7D,0xAD,0x19,0x41,0x75,0x7B,0x17,0xB5,0xE3,0x92,
		/* KEY 4 for cbc */
		0xB5,0x1D,0x7D,0x21,0x15,0xE7,0x0F,0x8B,0x6E,0x93,0x91,0x98,0xEB,0x6F,0xDE,0x4B};

	memcpy_c(ssf33->key,key,64);

	u8 iv[] = {
		/* IV 1 for key 3 */
		0x38,0x32,0xF2,0x7E,0x0A,0x14,0x51,0xAF,0x4B,0x97,0x47,0xA0,0x17,0x7C,0xDF,0xC2,
		/* IV 2 for key 4 */
		0x60,0x91,0x8F,0xB0,0x20,0x16,0x31,0x23,0xBB,0x44,0x35,0xB5,0xA6,0xB2,0xE6,0x97};

	memcpy_c(ssf33->iv,iv,64);

	u8 data[] = {
		/* DATA 1 for ecb */
		0xa9,0x37,0x07,0x49,0xfc,0x06,0xaf,0xe6,0x4e,0x30,0x68,0x01,0xd2,0x31,0xb3,0xac,
		/* DATA 2 for ecb */
		0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff,
		/* DATA 3 for cbc */
		0x63,0x36,0x3D,0x95,0xAC,0x94,0x46,0x28,0x29,0x2D,0xB1,0x2F,0x6B,0x39,0x37,0x5C,
		0x66,0x17,0x94,0x6A,0xFC,0xC2,0x73,0x14,0xE5,0xA9,0x4B,0x59,0xA1,0x98,0xCC,0x33,
		/* DATA 4 for cbc */
		0x29,0xBE,0x3B,0xDF,0xE2,0x16,0xA8,0xA2,0x52,0x4F,0xE9,0x38,0x31,0xE6,0xC2,0xD2,
		0x8F,0x39,0x8A,0x77,0xE5,0x3C,0x00,0xCF,0xA1,0x4D,0xD9,0xBE,0x2C,0xCE,0x61,0xCB};

	memcpy_c(ssf33->data,data,96);

	u8 stddata[] = {
		/* STD OUT 1 for ecb */
		0x9a,0xb7,0x1c,0xcc,0x22,0x7e,0x9e,0x58,0x7a,0xa0,0xe6,0xcf,0x49,0x08,0x5d,0x1f,
		/* STD OUT 2 for ecb */
		0x95,0xc3,0x19,0x3b,0x77,0x15,0xf8,0x79,0xd8,0xde,0x6f,0x19,0x00,0x66,0xc1,0xc2,
		/* STD OUT 3 for cbc */
		0xC6,0x2A,0xC6,0xF7,0x8E,0xEF,0xFE,0x46,0x71,0x20,0x06,0x5B,0x84,0x36,0xB7,0xDF,
		0xA8,0x63,0xAB,0x9F,0x73,0xC0,0x4B,0xBE,0x9D,0xAE,0x78,0xE5,0x92,0x09,0x71,0x01,
		/* STD OUT 4 for cbc */
		0x37,0xB1,0xB1,0x27,0x34,0xBA,0x1A,0xEF,0x45,0x20,0x94,0x96,0xED,0x75,0x58,0x43,
		0x8A,0xB5,0x2C,0x5C,0x1D,0x0B,0x53,0x22,0x02,0xD8,0x0B,0xAE,0x11,0xE9,0x22,0x52};

	memcpy_c(ssf33->stdout,stddata,96);

}

void STD_DES(void)
{
	struct std_data *des = &std_des;
	struct std_data *des3 = &std_3des;
	u8 key[] = {
		/* KEY 1 for ecb */
		0xAF,0x86,0x18,0x23,0x8C,0x94,0xA1,0x19,
		/* KEY 2 for ecb */
		0xAE,0x6D,0xE9,0x22,0xDB,0xB9,0x35,0x4D,
		/* KEY 3 for cbc */
		0xE3,0x83,0x0F,0x2F,0xF5,0x87,0x7D,0xAD,
		/* KEY 4 for cbc */
		0xB5,0x1D,0x7D,0x21,0x15,0xE7,0x0F,0x8B};
	memcpy_c(des->key,key,32);

	u8 key3[] = {
		/* KEY 1 for ecb */
		0xAF,0x86,0x18,0x23,0x8C,0x94,0xA1,0x19,0xAC,0x01,0x11,0x45,0xC4,0x4F,0x56,0x19,0x74,0xBA,0x18,0x69,0x5C,0xB4,0x54,0x05,
		/* KEY 2 for ecb */
		0xAE,0x6D,0xE9,0x22,0xDB,0xB9,0x35,0x4D,0xBB,0x6C,0xF9,0x42,0x71,0xB9,0x47,0xD4,0xEA,0xD6,0x9E,0x44,0x6B,0x9B,0x7B,0xD4,
		/* KEY 3 for cbc */
		0xE3,0x83,0x0F,0x2F,0xF5,0x87,0x7D,0xAD,0xEA,0xD6,0x9E,0x62,0xBD,0x9B,0x53,0xD4,0xBC,0x5C,0x49,0xDC,0xBD,0x59,0x85,0x90,
		/* KEY 4 for cbc */
		0xB5,0x1D,0x7D,0x21,0x15,0xE7,0x0F,0x8B,0xE3,0x83,0x0F,0x2F,0xF5,0x87,0x7D,0xAD,0xAE,0x6D,0xE9,0x22,0xDB,0xB9,0x35,0x4D};
	memcpy_c(des3->key,key3,96);

	u8 iv[] = {
		/* IV 1 for key 3 */
		0x38,0x32,0xF2,0x7E,0x0A,0x14,0x51,0xAF,
		/* IV 2 for key 4 */
		0x60,0x91,0x8F,0xB0,0x20,0x16,0x31,0x23};
	memcpy_c(des->iv,iv,16);
	memcpy_c(des3->iv,iv,16);

	u8 data[] = {
		/* DATA 1 for ecb */
		0xF7,0xAF,0x83,0xD4,0x98,0x7A,0x94,0x83,
		/* DATA 2 for ecb */
		0xC2,0xB7,0x71,0xDA,0x0F,0x6B,0x20,0xBE,
		/* DATA 3 for cbc */
		0x63,0x36,0x3D,0x95,0xAC,0x94,0x46,0x28,0x29,0x2D,0xB1,0x2F,0x6B,0x39,0x37,0x5C,
		/* DATA 4 for cbc */
		0x29,0xBE,0x3B,0xDF,0xE2,0x16,0xA8,0xA2,0x52,0x4F,0xE9,0x38,0x31,0xE6,0xC2,0xD2};
	memcpy_c(des->data,data,48);
	memcpy_c(des3->data,data,48);

	u8 stddata[] = {
		/* STD OUT 1 for ecb */
		0x39,0xc2,0x5b,0x99,0xd2,0x14,0xde,0x40,
		/* STD OUT 2 for ecb */
		0x09,0xa5,0x55,0xb5,0x3c,0x99,0x2a,0x33,
		/* STD OUT 3 for cbc */
		0x73,0xb8,0x13,0x1d,0x98,0x7f,0x57,0xde,0x37,0xd0,0xdb,0xa5,0x5c,0xdb,0x13,0x4d,
		/* STD OUT 4 for cbc */
		0x08,0xf5,0x60,0xe0,0xa9,0x73,0x95,0x00,0xf4,0x74,0x78,0xe3,0x05,0xd5,0x64,0xda};
	memcpy_c(des3->stdout,stddata,48);

	u8 stddata3[] = {
		/* STD OUT 1 for ecb */
		0x4c,0xe6,0x7d,0x81,0x24,0xbd,0x02,0xb1,
		/* STD OUT 2 for ecb */
		0x7e,0x6c,0x2c,0x95,0xa3,0x50,0x9b,0x81,
		/* STD OUT 3 for cbc */
		0x15,0xa3,0x5d,0x0b,0x00,0x4e,0xbc,0x33,0x74,0x7f,0xf7,0x43,0x91,0xbe,0xf1,0x02,
		/* STD OUT 4 for cbc */
		0x1d,0x7b,0xf2,0x82,0x80,0xc7,0x84,0x82,0xfe,0x54,0x60,0xfe,0x13,0x7a,0x22,0xcd};
	memcpy_c(des3->stdout,stddata3,48);
}

void STD_AES(void)
{
	struct std_data *aes = malloc(sizeof(struct std_data)+DATA_ALIGN);
	aes = (struct std_data *)(((unsigned long)aes+(DATA_ALIGN-1))&(~(DATA_ALIGN-1)));
	std_aes = aes;
	u8 key[] = {
		/* KEY 128 bit */
		0xAF,0x86,0x18,0x23,0x8C,0x94,0xA1,0x19,0xAE,0x6D,0xE9,0x22,0xDB,0xB9,0x35,0x4D,
		/* KEY 192 bit */
		0x9F,0xCE,0xB8,0x96,0x34,0x5C,0xE3,0x7C,0x3F,0xFE,0x54,0xEA,0xD1,0x15,0x28,0xED,
		0x87,0x1D,0x0F,0x6E,0x93,0xCC,0xFD,0x54,
		/* KEY 256 bit */
		0xE3,0x83,0x0F,0x2F,0xF5,0x87,0x7D,0xAD,0x19,0x41,0x75,0x7B,0x17,0xB5,0xE3,0x92,
		0xB5,0x1D,0x7D,0x21,0x15,0xE7,0x0F,0x8B,0x6E,0x93,0x91,0x98,0xEB,0x6F,0xDE,0x4B};
	memcpy_c(aes->key,key,72);

	u8 iv[] = {
		/* IV for 128/192/256 bit CTR */
		0x38,0x32,0xF2,0x7E,0x0A,0x14,0x51,0xAF,0x4B,0x97,0x47,0xA0,0x17,0x7C,0xDF,0xC2};
	memcpy_c(aes->iv,iv,16);

	u8 data[] = {
		/* DATA for 128/192/256 bit ecb */
		0xF7,0xAF,0x83,0xD4,0x98,0x7A,0x94,0x83,0x98,0xEE,0x24,0x8A,0xD8,0xB7,0x09,0x95,
		/* DATA for 128/192/256 bit CTR */
		0x63,0x36,0x3D,0x95,0xAC,0x94,0x46,0x28,0x29,0x2D,0xB1,0x2F,0x6B,0x39,0x37,0x5C,
		0x66,0x17,0x94,0x6A,0xFC,0xC2,0x73,0x14,0xE5,0xA9,0x4B,0x59,0xA1,0x98,0xCC,0x33};
	memcpy_c(aes->data,data,48);

	u8 stddata[] = {
		/* STD OUT for 128 bit ecb */
		0xa9,0x18,0x0e,0x6c,0xf0,0x2c,0x4a,0xad,0xe2,0x57,0x3b,0xc1,0x50,0x9e,0x26,0x41,
		/* STD OUT for 192 bit ecb */
		0x96,0x96,0x4f,0x1f,0x4b,0x3b,0x1e,0x3d,0x70,0xf4,0x6e,0x20,0xad,0xfc,0x1c,0x40,
		/* STD OUT for 256 bit ecb */
		0x3f,0x51,0x8e,0xc6,0x4c,0x33,0xb9,0x33,0x50,0x0e,0xf6,0x45,0x12,0x64,0x8c,0xff,
		/* STD OUT for 128 bit CTR */
		0x4b,0x03,0x7c,0x8f,0xf7,0x09,0x07,0x92,0x94,0x4b,0x60,0xff,0x19,0x4c,0x86,0x93,
		0xe9,0x39,0x8f,0x33,0xd9,0x9d,0xe2,0x74,0xd6,0xc7,0x9c,0xe5,0x18,0x4f,0x6a,0xcd,
		/* STD OUT for 192 bit CTR */
		0x80,0xd5,0xe7,0xed,0xd2,0x00,0xc4,0xd8,0xea,0x78,0x5f,0x28,0x43,0xaa,0xb1,0x14,
		0x5a,0x96,0xcc,0x0f,0x6a,0xa9,0x44,0x1f,0x11,0x0d,0x65,0x09,0xb0,0x19,0xc7,0x57,
		/* STD OUT for 256 bit CTR */
		0x6f,0x8e,0x07,0x76,0x8a,0x7d,0xd4,0xe8,0xa7,0x84,0x18,0xed,0xa0,0xbc,0xae,0x72,
		0x9c,0xcb,0x3e,0xfe,0xe0,0x4d,0x30,0x88,0xd0,0xbf,0xf8,0x8c,0xe4,0x12,0x77,0xa4};
	memcpy_c(aes->stdout,stddata,144);
}

void STD_HASH(void)
{

	struct std_data *sha1 = malloc(sizeof(struct std_data)+DATA_ALIGN);
	sha1 = (struct std_data *)(((unsigned long)sha1+(DATA_ALIGN-1))&(~(DATA_ALIGN-1)));
	struct std_data *sha256 = malloc(sizeof(struct std_data)+DATA_ALIGN);
	sha256 = (struct std_data *)(((unsigned long)sha256+(DATA_ALIGN-1))&(~(DATA_ALIGN-1)));
	struct std_data *sha512 = malloc(sizeof(struct std_data)+DATA_ALIGN);
	sha512 = (struct std_data *)(((unsigned long)sha512+(DATA_ALIGN-1))&(~(DATA_ALIGN-1)));
	struct std_data *sm3 = malloc(sizeof(struct std_data)+DATA_ALIGN);
	sm3 = (struct std_data *)(((unsigned long)sm3+(DATA_ALIGN-1))&(~(DATA_ALIGN-1)));

	std_sha1 = sha1;
	std_sha256 = sha256;
	std_sha512 = sha512;
	std_sm3 = sm3;

	u8 data[] = {
		/* DATA 2 */
		0x2C,0xB6,0xA0,0x6E,0x92,0xDC,0x95,0x70,0x24,0x2E,0x4E,0x77,0xA1,0x8D,0x6D,0xF0,
		0xBF,0xA1,0x63,0xB7,0x33,0xA6,0x81,0xDF,0xA8,0x6F,0x48,0x65,0x0A,0x25,0x1F,0x76};
	memcpy_c(sha1->data,data,33);
	memcpy_c(sha256->data,data,33);
	memcpy_c(sha512->data,data,33);
	memcpy_c(sm3->data,data,33);

	u8 sha1_stddata[] = {
		/* STD OUT 2 */
		0xf8,0x7b,0x6b,0x9a,0x7f,0x44,0x2d,0x26,0x88,0x6f,0xd1,0x5c,0xc3,0xf9,0xd0,0x2a,0xa3,0x4f,0xd8,0x88};
	memcpy_c(sha1->stdout,sha1_stddata,40);

	u8 sha256_stddata[] = {
		/* STD OUT 2 */
		0x46,0xa3,0x69,0x9b,0x9b,0x8a,0xad,0x1c,0xf8,0x15,0x71,0x16,0x38,0x50,0x2c,0x6f,
		0x80,0xb6,0x3f,0x5f,0x21,0x26,0x83,0xba,0xb0,0xa8,0x04,0x00,0x71,0xbd,0xfe,0x3c};
	memcpy_c(sha256->stdout,sha256_stddata,64);

	u8 sha512_stddata[] = {
		/* STD OUT 2 */
		0xc1,0x48,0x3e,0x30,0xcb,0x28,0x68,0x84,0xc3,0xde,0x66,0x60,0xdb,0xe5,0x88,0x56,
		0xea,0x13,0x11,0x4d,0x48,0x4b,0xce,0xe9,0xbe,0x63,0xef,0xfc,0x78,0x0c,0xe3,0xc9,
		0x9a,0x45,0x2c,0x01,0x60,0xb0,0x06,0x5e,0x09,0xf7,0xdc,0xb8,0xd2,0xaa,0x5f,0x3b,
		0xb6,0xa1,0x00,0x08,0x47,0x68,0x64,0x44,0x5a,0x92,0x98,0xb2,0x19,0x68,0xfa,0xaf};
	memcpy_c(sha512->stdout,sha512_stddata,128);

	u8 sm3_stddata[] = {
		/* STD OUT 2 */
		0x8E,0xD6,0xCD,0xEC,0x55,0x96,0xEA,0x9B,0x57,0x7A,0x19,0x5E,0x0A,0x41,0x9F,0xD9,
		0xFD,0x40,0x2C,0xCF,0x8B,0x11,0xB5,0x47,0xEC,0x99,0xAC,0xEE,0x81,0xB4,0xF4,0x88};
	memcpy_c(sm3->stdout,sm3_stddata,64);
}

void STD_HMAC(void)		//needed change by the real data,because the data below is just for hash not hmac!
{
	struct std_data *sha1 = &std_sha1;
	struct std_data *sha256 = &std_sha256;
	struct std_data *sha512 = &std_sha512;
	struct std_data *sm3 = &std_sm3;

	u8 data[] = {
		/* DATA 1 */
		0x61,
		/* DATA 2 */
		0x2C,0xB6,0xA0,0x6E,0x92,0xDC,0x95,0x70,0x24,0x2E,0x4E,0x77,0xA1,0x8D,0x6D,0xF0,
		0xBF,0xA1,0x63,0xB7,0x33,0xA6,0x81,0xDF,0xA8,0x6F,0x48,0x65,0x0A,0x25,0x1F,0x76};
	memcpy_c(sha1->data,data,33);
	memcpy_c(sha256->data,data,33);
	memcpy_c(sha512->data,data,33);
	memcpy_c(sm3->data,data,33);

	u8 sha1_stddata[] = {
		/* STD OUT 1 */
		0x86,0xf7,0xe4,0x37,0xfa,0xa5,0xa7,0xfc,0xe1,0x5d,0x1d,0xdc,0xb9,0xea,0xea,0xea,0x37,0x76,0x67,0xb8,
		/* STD OUT 2 */
		0xf8,0x7b,0x6b,0x9a,0x7f,0x44,0x2d,0x26,0x88,0x6f,0xd1,0x5c,0xc3,0xf9,0xd0,0x2a,0xa3,0x4f,0xd8,0x88};
	memcpy_c(sha1->stdout,sha1_stddata,40);

	u8 sha256_stddata[] = {
		/* STD OUT 1 */
		0xca,0x97,0x81,0x12,0xca,0x1b,0xbd,0xca,0xfa,0xc2,0x31,0xb3,0x9a,0x23,0xdc,0x4d,
		0xa7,0x86,0xef,0xf8,0x14,0x7c,0x4e,0x72,0xb9,0x80,0x77,0x85,0xaf,0xee,0x48,0xbb,
		/* STD OUT 2 */
		0x46,0xa3,0x69,0x9b,0x9b,0x8a,0xad,0x1c,0xf8,0x15,0x71,0x16,0x38,0x50,0x2c,0x6f,
		0x80,0xb6,0x3f,0x5f,0x21,0x26,0x83,0xba,0xb0,0xa8,0x04,0x00,0x71,0xbd,0xfe,0x3c};
	memcpy_c(sha256->stdout,sha256_stddata,64);

	u8 sha512_stddata[] = {
		/* STD OUT 1 */
		0x1f,0x40,0xfc,0x92,0xda,0x24,0x16,0x94,0x75,0x09,0x79,0xee,0x6c,0xf5,0x82,0xf2,
		0xd5,0xd7,0xd2,0x8e,0x18,0x33,0x5d,0xe0,0x5a,0xbc,0x54,0xd0,0x56,0x0e,0x0f,0x53,
		0x02,0x86,0x0c,0x65,0x2b,0xf0,0x8d,0x56,0x02,0x52,0xaa,0x5e,0x74,0x21,0x05,0x46,
		0xf3,0x69,0xfb,0xbb,0xce,0x8c,0x12,0xcf,0xc7,0x95,0x7b,0x26,0x52,0xfe,0x9a,0x75,
		/* STD OUT 2 */
		0xc1,0x48,0x3e,0x30,0xcb,0x28,0x68,0x84,0xc3,0xde,0x66,0x60,0xdb,0xe5,0x88,0x56,
		0xea,0x13,0x11,0x4d,0x48,0x4b,0xce,0xe9,0xbe,0x63,0xef,0xfc,0x78,0x0c,0xe3,0xc9,
		0x9a,0x45,0x2c,0x01,0x60,0xb0,0x06,0x5e,0x09,0xf7,0xdc,0xb8,0xd2,0xaa,0x5f,0x3b,
		0xb6,0xa1,0x00,0x08,0x47,0x68,0x64,0x44,0x5a,0x92,0x98,0xb2,0x19,0x68,0xfa,0xaf};
	memcpy_c(sha512->stdout,sha512_stddata,128);

	u8 sm3_stddata[] = {
		/* STD OUT 1 */
		0x62,0x34,0x76,0xAC,0x18,0xF6,0x5A,0x29,0x09,0xE4,0x3C,0x7F,0xEC,0x61,0xB4,0x9C,
		0x7E,0x76,0x4A,0x91,0xA1,0x8C,0xCB,0x82,0xF1,0x91,0x7A,0x29,0xC8,0x6C,0x5E,0x88,
		/* STD OUT 2 */
		0x8E,0xD6,0xCD,0xEC,0x55,0x96,0xEA,0x9B,0x57,0x7A,0x19,0x5E,0x0A,0x41,0x9F,0xD9,
		0xFD,0x40,0x2C,0xCF,0x8B,0x11,0xB5,0x47,0xEC,0x99,0xAC,0xEE,0x81,0xB4,0xF4,0x88};
	memcpy_c(sm3->stdout,sm3_stddata,64);
}


